package com.wcz.code.图形篇;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.lang.reflect.InvocationTargetException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

import com.wcz.code.util.Common;

/**
 * @author 伪尘子
 *
 * 2012-6-18
 */
public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
		Runnable doHelloWorld = new Runnable() {
		     public void run() {
		         System.out.println("Hello World on " + Thread.currentThread());
		         JFrame jf=new JFrame();
		         jf.setTitle("Java 窗口");
		         jf.setIconImage(Common.readImage("/root/image/icon.gif"));
		         jf.add(new JLabel(new ImageIcon(Common.readImage("/root/image/carmera.gif"))));
		         
		         jf.pack();
		         jf.setVisible(true);
		         
		     }
		 };
		 
		 /*invokeLoter在其他线程走完后，才开始运行【启动窗口都是使用本方法】*/
		 /*invokeAndWait本线程走完后，继续走其他线程【不用考虑太多，用得不多】*/
//		 SwingUtilities.invokeAndWait(doHelloWorld);
//		 SwingUtilities.invokeLater(doHelloWorld);

		
		 
		 SwingUtilities.invokeLater(doHelloWorld);

	}

}
